package usian.hx.login.controller;


import com.usian.common.pojo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import usian.hx.login.pojo.TbUser;
import usian.hx.login.service.LoginService;

@RestController
@RequestMapping("api/user")
public class LoginController {
    @Autowired
    private LoginService loginService;

    @RequestMapping("send")
    public ResultVo send(String phone) throws Exception{
        return  loginService.sendCode(phone);
    }

    @RequestMapping("login")
    public ResultVo login(String phone,String code) throws Exception{
        return  loginService.userLogin(phone,code);
    }

    @RequestMapping("save")
    public ResultVo save (@RequestBody TbUser tbUser){
        return  loginService.save(tbUser);

    }
}
